---
import wikiConfig from "../../../wiki.config";
import { ViewTransitions } from "astro:transitions";
import BrowserVersionWarn from "@/components/BrowserVersionWarn/index.astro";
import ServiceWorker from "./ServiceWorker.astro";

export interface Props {
  title?: string;
  customHeadTags?: string;
}

const { title, customHeadTags } = Astro.props;

const { BasicTitle, favicon } = wikiConfig;

const FinalTitle = `${title || "Loading..."} | ${BasicTitle}`;
---

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width" />
  <link rel="icon" type="image/svg+xml" href={favicon} />
  <!-- baidu analytics -->
  <script>
    var _hmt = _hmt || [];
    (function () {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?e02a729d4e40cc7fb4106fa93bd0ebba";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode?.insertBefore(hm, s);
    })();
  </script>
  {customHeadTags}
  <meta name="description" content={FinalTitle} />
  <title>{FinalTitle}</title>
  <ViewTransitions />
  <BrowserVersionWarn />
  <ServiceWorker />
</head>
